import random
secret = random.randint (1,10) 
print('游戏开始')
temp = input('请输入数字\n')
while not temp.isdigit():
    temp = input('请输入数字\n')
guess = int(temp)
i=0
while (guess != secret) or (i<3):
    i+=1
    if guess == secret:
        print ('你猜对了')
        break
    else:
        if guess < secret:
            print('小了')

        else:
            print('大了')
        if i < 3:
            temp = input('请输入数字\n')
            guess = int(temp)
        else:
            print('你猜错了')
            print('次数用完')
            break
print ('游戏结束')






